Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCF experience design improvements #4222

Merged
merged 18 commits into from
Oct 10, 2023

Conversation

galvana
Copy link
Contributor

@galvana galvana commented Oct 3, 2023

Closes #4185

Description Of Changes

Updating default fides.css and some component functionality to match our new designs https://www.figma.com/file/dmEwdK3xZwjKfGVQ9t66xe/Fides-v.2-Master-Working-Files?node-id=10555%3A602217&mode=dev. The designs should match for the most part with the following exceptions:

  • Responsive design was not considered as part of this iteration
  • Hide example / show example toggle was not implemented

Code Changes

  • fides.css and minor component changes

Steps to Confirm

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Issue Requirements are Met
  • Relevant Follow-Up Issues Created
  • Update CHANGELOG.md

@galvana galvana linked an issue Oct 3, 2023 that may be closed by this pull request
@cypress
Copy link

cypress bot commented Oct 5, 2023

Passing run #4523 ↗︎

0 4 0 0 Flakiness 0

Details:

Merge db39bfe into 3c767c4...
Project: fides Commit: 7309e222f2 ℹ️
Status: Passed Duration: 00:54 💡
Started: Oct 9, 2023 8:05 PM Ended: Oct 9, 2023 8:06 PM

Review all test suite changes for PR #4222 ↗︎

<div id="fides-banner-title" className="fides-banner-title">
{experience.title}
</div>
{showGpcBadge && bannerType !== "TCF" ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing in bannerType to hide the GpcBadge for the TCF banner/modal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm if its only purpose is whether or not to show the gpc badge, maybe instead of bannerType we make the prop hideGpc, then change above. I think that makes it a bit clearer for someone using this component exactly what that prop is going to do

const showGpcBadge = getConsentContext().globalPrivacyControl && !hideGpc;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually maybe a better idea is to modify the function getGlobalPrivacyControl to query window.Fides.options.tcfEnabled. if it's enabled, return false. then I don't think gpc would ever render for TCF, and it'd be tied to gpc logic, as opposed to component logic, which is nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that, much cleaner!

const dialog = new A11yDialogLib(node);
dialog
.on("show", () => (document.documentElement.style.overflowY = "hidden"))
.on("hide", () => (document.documentElement.style.overflowY = ""));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lightweight version of the scroll lock, the more robust version takes 1Kb https://a11y-dialog.netlify.app/advanced/scroll-lock/

@galvana galvana requested a review from allisonking October 6, 2023 18:06
@galvana galvana marked this pull request as ready for review October 6, 2023 18:06
Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing job @galvana ! I'm going to play around some more locally, but wanted to leave you some comments first!

clients/fides-js/rollup.config.mjs Show resolved Hide resolved
onVendorPageClick?: () => void;
buttonGroup: VNode;
bannerType?: String;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't even know there was a String! looks like we should prefer string tho: https://stackoverflow.com/questions/14727044/what-is-the-difference-between-types-string-and-string

Suggested change
bannerType?: String;
bannerType?: string;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even better, would be to restrict this to the strings it can be, i.e. "TCF"|"notices"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ended up going away after refactoring the GPC check

<div id="fides-banner-title" className="fides-banner-title">
{experience.title}
</div>
{showGpcBadge && bannerType !== "TCF" ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm if its only purpose is whether or not to show the gpc badge, maybe instead of bannerType we make the prop hideGpc, then change above. I think that makes it a bit clearer for someone using this component exactly what that prop is going to do

const showGpcBadge = getConsentContext().globalPrivacyControl && !hideGpc;

}: {
attributes: Attributes;
experience: ExperienceConfig;
children: ComponentChildren;
onVendorPageClick?: () => void;
modalType?: String;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here—see my meandering comment thoughts about on bannerType

@@ -230,6 +258,7 @@ button.fides-banner-button.fides-banner-button-secondary {
background: var(--fides-overlay-secondary-button-background-color);
color: var(--fides-overlay-secondary-button-text-color);
border: 1px solid var(--fides-overlay-primary-button-background-color);
border-radius: var(--fides-overlay-button-border-radius);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm can this border-radius be defined on .fides-banner-button instead of on the two hover states? or does that not work since the border isn't defined until the hover state? (just trying to see if we can cut down on one line of CSS 😵 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@@ -243,7 +272,9 @@ button.fides-banner-button.fides-banner-button-tertiary {
color: var(--fides-overlay-link-font-color);
text-decoration: underline;
cursor: pointer;
line-height: 2em;
font-weight: 500;
font-size: var(--fides-overlay-font-size-body);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm should all the buttons be this size by default?

}

.fides-gpc-badge {
text-transform: uppercase;
padding: 0 4px;
font-weight: 700;
border-radius: var(--fides-overlay-button-border-radius);
border-radius: 4px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be

Suggested change
border-radius: 4px;
border-radius: var(--fides-overlay-badge-border-radius);

?

<div id="fides-banner-title" className="fides-banner-title">
{experience.title}
</div>
{showGpcBadge && bannerType !== "TCF" ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually maybe a better idea is to modify the function getGlobalPrivacyControl to query window.Fides.options.tcfEnabled. if it's enabled, return false. then I don't think gpc would ever render for TCF, and it'd be tied to gpc logic, as opposed to component logic, which is nice!

Comment on lines 341 to 346
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
gridColumn: 1,
gridRow: 2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this styling is doing anything, is it? since there's only the one item inside

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Comment on lines 119 to 123
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here—I don't think this is doing anything since there's only one child element? trying to save you some kb 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay @galvana I'm done reviewing for now! let me know what you think of the comments I left. none of them are really blocking, but I think they're worth considering. awesome job, should be ready to merge soon! ✨

@galvana galvana requested a review from allisonking October 6, 2023 22:19
Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amaaaaazing!!!

@@ -13,6 +13,10 @@ declare global {
* having to modify the browser before the script runs.
*/
const getGlobalPrivacyControl = (): boolean | undefined => {
if (window.Fides.options.tcfEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's update the docstring above to also mention how we don't use GPC with TCF

@galvana galvana merged commit e30c439 into main Oct 10, 2023
9 checks passed
@galvana galvana deleted the PROD-1084-TCF-experience-design-improvements branch October 10, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TCF experience design improvements
2 participants